//el-select选择框按钮
export const selectFn = (options, selects, index) => {
    let returnSelect = []
    // 1全选
    if (index == 1) {
        returnSelect = selects
        options.map((item) => {
            if (!selects.includes(item.value)) {
                returnSelect.push(item.value);
            }
        });
    }
    // 2反选
    else if (index == 2) {
        options.map((item) => {
            let index = selects.indexOf(item.value);
            //判断现有选中数据是否包含,不包含则进行反选数据
            if (index != -1) {
            } else {
                returnSelect.push(item.value);
            }
        });
    }
    // 3清空
    // else if (index == 3) {

    // }
    return returnSelect;
}


//el-select的options数组处理
export const selectOptions = (oldOptions, valueName, labelName) => {
    return oldOptions.map((item) => {
        return {
            value: `${item[valueName]}`,
            label: `${item[labelName]}`,
        };
    });
}